/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.constant.enums;

import com.comac.ins.common.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 大文件类型
 *
 * @author hxloongs
 * @date 2025-3-25
 */
@AllArgsConstructor
@Getter
public enum IsfdLargeFileTypeEnum {
    MESH_OP2("mesh_op2", "自然网格结果库类型");
    private final String value;
    private final String desc;

    public static String getDescByValue(String value) {
        IsfdLargeFileTypeEnum actionTypeEnum = forValue(value);
        if (actionTypeEnum == null) {
            return null;
        }
        return actionTypeEnum.getDesc();
    }

    public static IsfdLargeFileTypeEnum forValue(String value) {
        if (StringUtils.isBlank(value)) {
            return null;
        }
        for (IsfdLargeFileTypeEnum actionTypeEnum : IsfdLargeFileTypeEnum.values()) {
            if (actionTypeEnum.getValue().equals(value)) {
                return actionTypeEnum;
            }
        }
        return null;
    }

    public static IsfdLargeFileTypeEnum forDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (IsfdLargeFileTypeEnum actionTypeEnum : IsfdLargeFileTypeEnum.values()) {
            if (desc.equals(actionTypeEnum.getDesc())) {
                return actionTypeEnum;
            }
        }
        return null;
    }
}
